
// 查询符合某些条件的品牌信息
function queryByCondition(){

    let brandName = $(".brandName").val();
    let brandStatus = $("select").val();

    $.ajax({
        url:"/brandManage/getBrandByCondition2",
        type:"post",
        data:{"brandName":brandName,"brandStatus":brandStatus},
        dataType:"json",
        success:function (result){
            if (result != null){
                if (result.data != null){
                    let str = "";
                    for (let i in result.data) {
                        str += "<tr>\n" +
                        "          <td>1</td>\n" +
                        "          <td>"+result.data[i].brandName+"</td>\n" +
                        "          <td>"+(result.data[i].brandStatus==1?'可用':'不可用')+"</td>\n" +
                            "          <td>"+result.data[i].createTime+"</td>\n" +
                            "          <td>"+result.data[i].createName+"</td>\n" +
                            "          <td>\n" +
                            "            <a href=\"brandUpdate.html\" class=\"tablelink\">修改</a>\n" +
                            "            <a href=\"javascript:void(0)\" class=\"tablelink\" onclick=\"tipOpen('是否确认注销此条信息？')\">注销</a>\n" +
                            "          </td>\n" +
                            "        </tr>";
                    }
                    $(".tablelist tbody").html(str);
                }else {
                    alert("未查询到结果");
                }
            }else {
                alert("pageModel为空了");
            }
        }
    })
}

// 注销品牌
function deleteBrand(){
    let b = confirm("确定要注销该品牌么？");
    if (b){
        let brandName = $(".brandName2").html();
        $.ajax({
            url:"/brandManage/deleteBrand",
            type:"post",
            data:{"brandName":brandName},
            dataType:"json",
            success:function (result){
                if (result == true){
                    alert("删除成功");
                    location.reload();
                }else {
                    alert("删除失败");
                }
            }
        })
    }
}
